<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绑定事件函数</title>
</head>

<body>
    <div id="btn">我是按钮，请点击我</div>
    <script type="text/javascript">
        var btn = document.getElementById('btn');
        btn.onclick = function() {
            console.log('点击按钮后，要做的事情');
        };
    </script>
</body>

</html>